//
//  UserDetailVC.m
//  MovieDate
//
//  Created by 杨运涛 on 16/3/13.
//  Copyright © 2016年 MovieDate. All rights reserved.
//

#import "UserDetailVC.h"
#import "TDJScrollAdView.h"
#import "WarringVC.h"

@interface UserDetailVC () <TDJScrollViewDataSource, TDJScrollViewDelegate,UITableViewDataSource,UITableViewDelegate> {
    TDJScrollAdView *srcView;
    
    NSMutableArray *pArrayUserPic;
}

@property (weak, nonatomic) IBOutlet UILabel *pLblName;
@property (weak, nonatomic) IBOutlet UIImageView *pImgSex;
@property (weak, nonatomic) IBOutlet UILabel *pLblAge;
@property (weak, nonatomic) IBOutlet UILabel *pLblTime;
@property (weak, nonatomic) IBOutlet UILabel *pLblAddress;
@property (weak, nonatomic) IBOutlet UILabel *pLblDescription;

@property (weak, nonatomic) IBOutlet UIView *pViewHeader;
@property (nonatomic,strong) User *user;
@end

@implementation UserDetailVC

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBarHidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.navigationController.navigationBarHidden = NO;
}


- (void)initInfo {
    [super initInfo];
    
    pArrayUserPic = [NSMutableArray array];
    [pArrayUserPic addObject:[NSString stringWithFormat:@"%@/api/common/file/imgGet?fid=%@", IP, _pUser.headImage]];
    
    [self.pViewHeader setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width)];
    self.pTableView.tableHeaderView = self.pViewHeader;
    srcView = [[TDJScrollAdView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width)];
    [srcView setDataSource:self];
    [srcView setDelegate:self];
    [srcView.timerScroll invalidate];
    [self.pViewHeader addSubview:srcView];
    [srcView reloadData];
    
    [self initTabelView];
    [self requestUserMessage];
    [self requestUserAlbum];
}

-(void)requestUserMessage{
    [TDNetwork  requsetUseMessagePostUrl:useGetMessageIP uid:_pUser.uid complete:^(BOOL succeed, NSString *ret, NSDictionary *dictionary) {
        if (succeed) {
            
            NSDictionary *dic = [dictionary valueForKey:@"res"];
            NSLog(@" 附近用户详情信息是： %@",dic);
           // User *user = [User defaultUser];
            if (dic) {
                NSString *labels =  [dic valueForKey:@"labels"];
                @try {
                    [labels stringByReplacingOccurrencesOfString:@"\\U" withString:@"!u"];
                    [labels stringByReplacingOccurrencesOfString:@"\\" withString:@""];
                    [labels stringByReplacingOccurrencesOfString:@"!u" withString:@"\\u"];
                    NSString*labels2 =  [labels stringByReplacingOccurrencesOfString:@"\'" withString:@"\""];
                    NSArray *arr=  [UserDetailVC arrWithJsonString:labels2];
                  
                    for (NSDictionary *dic in arr) {
                        MovieLabelModel *movieLbM = [[MovieLabelModel alloc]init];
                        movieLbM.name = [dic valueForKey:@"name"];
                        movieLbM.type = [NSString stringWithFormat:@"%@",[dic valueForKey:@"type"]];
                        movieLbM.uuid = [NSString stringWithFormat:@"%@",[dic valueForKey:@"uuid"]];
                        [_pUser.labels addObject:movieLbM];
                    }
                } @catch (NSException *exception) {
                } @finally {
                }

                [self.pTableView reloadData];
            }
        }else{
        }
    }];
}
+ (NSMutableArray *)arrWithJsonString:(NSString *)jsonString {
    if (jsonString == nil) {
        return nil;
    }
    NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
    NSError *err;
    NSMutableArray *arr = [NSJSONSerialization JSONObjectWithData:jsonData
                                                          options:NSJSONReadingMutableContainers
                                                            error:&err];
    if(err) {
        NSLog(@"json解析失败：%@",err);
        return nil;
    }
    return arr;
}
-(void)initTabelView{
    self.pTableView.delegate = self;
    self.pTableView.dataSource = self;
}

- (IBAction)btnPopAction:(id)sender {
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (IBAction)btnLikeAction:(id)sender {
    if ([self.pDelegate respondsToSelector:@selector(selLike)]) {
        [self.pDelegate selLike];
    }
    [self btnPopAction:nil];
}

- (IBAction)btnDislikeAction:(id)sender {
    if ([self.pDelegate respondsToSelector:@selector(selDislike)]) {
        [self.pDelegate selDislike];
    }
    [self btnPopAction:nil];
}

- (IBAction)btnWarringAction:(UIButton *)sender {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Warring" bundle:nil];
    WarringVC *warringVC = [storyboard instantiateViewControllerWithIdentifier:@"WarringVC"];
    warringVC.pStrID = _pUser.uid;
    [self.navigationController pushViewController:warringVC animated:YES];
}


#pragma mark - TDJScrollViewDataSource, TDJScrollViewDelegate

- (NSInteger)numberOfPages {
    return pArrayUserPic.count;
}

- (UIView *)pageAtIndex:(NSInteger)index
{
    UIImageView *imgPic = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, srcView.frame.size.height)];
    [imgPic sd_setImageWithURL:[NSURL URLWithString:[pArrayUserPic objectAtIndex:index]]];
    
    return imgPic;
}

- (void)didClickPage:(TDJScrollAdView *)view atIndex:(NSInteger)index {
    
}


- (void)requestUserAlbum
{
    [TDNetwork getUserAlbumImagePostUrl:getAlbumImageIP uid:[_pUser.uid integerValue] complete:^(BOOL succeed, NSString *ret, NSDictionary *dictionary) {
        if (succeed) {
            NSDictionary *dict = [dictionary objectForKey:@"res"];
            @try {
                NSArray *array = [dict objectForKey:@"albumList"];
                for (NSDictionary *item in array) {
                    [pArrayUserPic addObject:[NSString stringWithFormat:@"%@/api/common/file/imgGet?fid=%@", IP, [item objectForKey:@"albumId"]]];
                }
            }
            @catch (NSException *exception) {}
            @finally {
                [srcView reloadData];
            }
        }
    }];
}

#pragma mark  UITableViewDataSource  UITableViewDelegate

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;

}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return _pUser.labels.count>0?8:1;
}
/*
 @property (weak, nonatomic) IBOutlet UILabel *pLblName;
 @property (weak, nonatomic) IBOutlet UIImageView *pImgSex;
 @property (weak, nonatomic) IBOutlet UILabel *pLblAge;
 @property (weak, nonatomic) IBOutlet UILabel *pLblTime;
 @property (weak, nonatomic) IBOutlet UILabel *pLblAddress;
 @property (weak, nonatomic) IBOutlet UILabel *pLblDescription;
 */
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row ==0) {
        UITableViewCell *cell = [self cellforRowWithTabelView:tableView Identifier:@"idXYuserMessageCell"];
        UIImageView *pImgSex = [cell viewWithTag:1060];
        UILabel *pLblName = [cell viewWithTag:1049];
        UILabel *pLblAge = [cell viewWithTag:1051];
        UILabel *pLblTime = [cell viewWithTag:1052];
        UILabel *pLblAddress = [cell viewWithTag:1053];
        UILabel *pLblDescription = [cell viewWithTag:1054];
        [pLblName setText:_pUser.nickname];
        [pImgSex setImage:[UIImage imageNamed:[_pUser.userSex isEqualToString:@"1"]?@"sex_boy":@"sex_girl"]];
        [pLblAge setText:_pUser.userAge];
        [pLblTime setText:_pUser.activeTimeLast];
        [pLblAddress setText:_pUser.address];
        [pLblDescription setText:_pUser.signature];
        
        if ([_pUser.userSex isEqualToString:@"1"]) {
            [_pLblAge setTextColor:[UIColor colorWithRed:108/255.0f green:181/255.0f blue:255/255.0f alpha:1]];
        } else {
            [_pLblAge setTextColor:[UIColor colorWithRed:252/255.0f green:110/255.0f blue:108/255.0f alpha:1]];
        }

        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        UIView *viewBG = (UIView *)[cell.contentView viewWithTag:1070];
        if (_pUser.labels.count > 0) {
            [viewBG setHidden:NO];
        } else {
            [viewBG setHidden:YES];
        }
        
        return cell;
    } else {
        UITableViewCell *cell = [self cellforRowWithTabelView:tableView Identifier:@"idMovieLabelCell"];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        UILabel *titleLB = [cell viewWithTag:1070];
        UILabel *contentLB = [cell viewWithTag:1071];
        UILabel *contentLB1 = [cell viewWithTag:1072];
        UILabel *contentLB2 = [cell viewWithTag:1073];
        UILabel *contentLB3 = [cell viewWithTag:1074];
        UILabel *contentLB4 = [cell viewWithTag:1075];
        UILabel *contentLB5 = [cell viewWithTag:1076];

        [contentLB1 setHidden:YES];
        [contentLB2 setHidden:YES];
        [contentLB3 setHidden:YES];
        [contentLB4 setHidden:YES];
        [contentLB5 setHidden:YES];
        contentLB.layer.masksToBounds = YES;
        contentLB.layer.cornerRadius = 10;
        contentLB1.layer.masksToBounds = YES;
        contentLB1.layer.cornerRadius = 10;
        contentLB2.layer.masksToBounds = YES;
        contentLB2.layer.cornerRadius = 10;
        contentLB3.layer.masksToBounds = YES;
        contentLB3.layer.cornerRadius = 10;
        contentLB4.layer.masksToBounds = YES;
        contentLB4.layer.cornerRadius = 10;
        contentLB5.layer.masksToBounds = YES;
        contentLB5.layer.cornerRadius = 10;

        
        switch (indexPath.row) {
                
            case 1:
                titleLB.text = @"星   座";
                for (MovieLabelModel *mlm in  _pUser.labels) {
                    if ([mlm.type isEqualToString:@"1"]) {
                                contentLB.text = [NSString stringWithFormat:@"  %@      ", mlm.name];
                    }
                }
                contentLB.textColor = [UIColor colorWithRed:254.0/255 green:189.0/255 blue:1.0/255 alpha:1];
                contentLB.backgroundColor = [UIColor colorWithRed:255.0/255 green:250.0/255 blue:238.0/255 alpha:1];
                contentLB.layer.masksToBounds = YES;
                contentLB.layer.cornerRadius = 10;
                break;
            case 2:
            {
                titleLB.text = @"美   食";
                NSMutableArray *array = [NSMutableArray array];
                for (MovieLabelModel *mlm in _pUser.labels) {
                    if ([mlm.type isEqualToString:@"2"]) {
                        [array addObject:mlm];
                    }
                }
                
                for (int i = 0; i < array.count; i++) {
                    MovieLabelModel *model = [array objectAtIndex:i];
                    if (i == 0) {
                        contentLB.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB setHidden:NO];
                    } else if(i == 1) {
                        contentLB1.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB1 setHidden:NO];
                    } else if(i == 2) {
                        contentLB2.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB2 setHidden:NO];
                    } else if(i == 3) {
                        contentLB3.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB3 setHidden:NO];
                    } else if(i == 4) {
                        contentLB4.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB4 setHidden:NO];
                    } else if(i == 5) {
                        contentLB5.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB5 setHidden:NO];
                    }
                }
                
                
                contentLB.textColor = [UIColor colorWithRed:254.0/255 green:144.0/255 blue:57.0/255 alpha:1];
                contentLB.backgroundColor = [UIColor colorWithRed:255.0/255 green:246.0/255 blue:239.0/255 alpha:1];
                
                contentLB1.textColor = [UIColor colorWithRed:254.0/255 green:144.0/255 blue:57.0/255 alpha:1];
                contentLB1.backgroundColor = [UIColor colorWithRed:255.0/255 green:246.0/255 blue:239.0/255 alpha:1];

                contentLB2.textColor = [UIColor colorWithRed:254.0/255 green:144.0/255 blue:57.0/255 alpha:1];
                contentLB2.backgroundColor = [UIColor colorWithRed:255.0/255 green:246.0/255 blue:239.0/255 alpha:1];

                contentLB3.textColor = [UIColor colorWithRed:254.0/255 green:144.0/255 blue:57.0/255 alpha:1];
                contentLB3.backgroundColor = [UIColor colorWithRed:255.0/255 green:246.0/255 blue:239.0/255 alpha:1];

                contentLB4.textColor = [UIColor colorWithRed:254.0/255 green:144.0/255 blue:57.0/255 alpha:1];
                contentLB4.backgroundColor = [UIColor colorWithRed:255.0/255 green:246.0/255 blue:239.0/255 alpha:1];

                contentLB5.textColor = [UIColor colorWithRed:254.0/255 green:144.0/255 blue:57.0/255 alpha:1];
                contentLB5.backgroundColor = [UIColor colorWithRed:255.0/255 green:246.0/255 blue:239.0/255 alpha:1];
            }
                
                break;
            case 3:
            {
                titleLB.text = @"电   影";
                NSMutableArray *array = [NSMutableArray array];
                for (MovieLabelModel *mlm in  _pUser.labels) {
                    if ([mlm.type isEqualToString:@"3"]) {
                        [array addObject:mlm];
                    }
                }
                
                for (int i = 0; i < array.count; i++) {
                    MovieLabelModel *model = [array objectAtIndex:i];
                    if (i == 0) {
                        contentLB.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB setHidden:NO];
                    } else if(i == 1) {
                        contentLB1.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB1 setHidden:NO];
                    } else if(i == 2) {
                        contentLB2.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB2 setHidden:NO];
                    } else if(i == 3) {
                        contentLB3.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB3 setHidden:NO];
                    } else if(i == 4) {
                        contentLB4.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB4 setHidden:NO];
                    } else if(i == 5) {
                        contentLB5.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB5 setHidden:NO];
                    }
                }
                
                
                contentLB.textColor = [UIColor colorWithRed:254.0/255 green:0.0/255 blue:2.0/255 alpha:1];
                contentLB.backgroundColor = [UIColor colorWithRed:255.0/255 green:238.0/255 blue:238.0/255 alpha:1];
                
                contentLB1.textColor = [UIColor colorWithRed:254.0/255 green:0.0/255 blue:2.0/255 alpha:1];
                contentLB1.backgroundColor = [UIColor colorWithRed:255.0/255 green:238.0/255 blue:238.0/255 alpha:1];
                
                contentLB2.textColor = [UIColor colorWithRed:254.0/255 green:0.0/255 blue:2.0/255 alpha:1];
                contentLB2.backgroundColor = [UIColor colorWithRed:255.0/255 green:238.0/255 blue:238.0/255 alpha:1];
                
                contentLB3.textColor = [UIColor colorWithRed:254.0/255 green:0.0/255 blue:2.0/255 alpha:1];
                contentLB3.backgroundColor = [UIColor colorWithRed:255.0/255 green:238.0/255 blue:238.0/255 alpha:1];
                
                contentLB4.textColor = [UIColor colorWithRed:254.0/255 green:0.0/255 blue:2.0/255 alpha:1];
                contentLB4.backgroundColor = [UIColor colorWithRed:255.0/255 green:238.0/255 blue:238.0/255 alpha:1];
                
                contentLB5.textColor = [UIColor colorWithRed:254.0/255 green:0.0/255 blue:2.0/255 alpha:1];
                contentLB5.backgroundColor = [UIColor colorWithRed:255.0/255 green:238.0/255 blue:238.0/255 alpha:1];
            }
                break;
            case 4:
            {
               titleLB.text = @"演   员";
                NSMutableArray *array = [NSMutableArray array];
                for (MovieLabelModel *mlm in  _pUser.labels) {
                    if ([mlm.type isEqualToString:@"4"]) {
                        [array addObject:mlm];
                    }
                }
                
                for (int i = 0; i < array.count; i++) {
                    MovieLabelModel *model = [array objectAtIndex:i];
                    if (i == 0) {
                        contentLB.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB setHidden:NO];
                    } else if(i == 1) {
                        contentLB1.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB1 setHidden:NO];
                    } else if(i == 2) {
                        contentLB2.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB2 setHidden:NO];
                    } else if(i == 3) {
                        contentLB3.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB3 setHidden:NO];
                    } else if(i == 4) {
                        contentLB4.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB4 setHidden:NO];
                    } else if(i == 5) {
                        contentLB5.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB5 setHidden:NO];
                    }
                }
                
                
                contentLB.textColor = [UIColor colorWithRed:195.0/255 green:17.0/255 blue:233.0/255 alpha:1];
                contentLB.backgroundColor = [UIColor colorWithRed:252.0/255 green:238.0/255 blue:255.0/255 alpha:1];
                
                contentLB1.textColor = [UIColor colorWithRed:195.0/255 green:17.0/255 blue:233.0/255 alpha:1];
                contentLB1.backgroundColor = [UIColor colorWithRed:252.0/255 green:238.0/255 blue:255.0/255 alpha:1];
                
                contentLB2.textColor = [UIColor colorWithRed:195.0/255 green:17.0/255 blue:233.0/255 alpha:1];
                contentLB2.backgroundColor = [UIColor colorWithRed:252.0/255 green:238.0/255 blue:255.0/255 alpha:1];
                
                contentLB3.textColor = [UIColor colorWithRed:195.0/255 green:17.0/255 blue:233.0/255 alpha:1];
                contentLB3.backgroundColor = [UIColor colorWithRed:252.0/255 green:238.0/255 blue:255.0/255 alpha:1];
                
                contentLB4.textColor = [UIColor colorWithRed:195.0/255 green:17.0/255 blue:233.0/255 alpha:1];
                contentLB4.backgroundColor = [UIColor colorWithRed:252.0/255 green:238.0/255 blue:255.0/255 alpha:1];
                
                contentLB5.textColor = [UIColor colorWithRed:195.0/255 green:17.0/255 blue:233.0/255 alpha:1];
                contentLB5.backgroundColor = [UIColor colorWithRed:252.0/255 green:238.0/255 blue:255.0/255 alpha:1];
            }
                break;
            case 5:
            {
               titleLB.text = @"导   演";
                NSMutableArray *array = [NSMutableArray array];

                for (MovieLabelModel *mlm in  _pUser.labels) {
                    if ([mlm.type isEqualToString:@"5"]) {
                        [array addObject:mlm];
                    }
                }
                
                for (int i = 0; i < array.count; i++) {
                    MovieLabelModel *model = [array objectAtIndex:i];
                    if (i == 0) {
                        contentLB.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB setHidden:NO];
                    } else if(i == 1) {
                        contentLB1.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB1 setHidden:NO];
                    } else if(i == 2) {
                        contentLB2.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB2 setHidden:NO];
                    } else if(i == 3) {
                        contentLB3.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB3 setHidden:NO];
                    } else if(i == 4) {
                        contentLB4.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB4 setHidden:NO];
                    } else if(i == 5) {
                        contentLB5.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB5 setHidden:NO];
                    }
                }
                
                
                contentLB.textColor = [UIColor colorWithRed:0.0/255 green:72.0/255 blue:255.0/255 alpha:1];
                contentLB.backgroundColor = [UIColor colorWithRed:239.0/255 green:243.0/255 blue:255.0/255 alpha:1];
                
                contentLB1.textColor = [UIColor colorWithRed:0.0/255 green:72.0/255 blue:255.0/255 alpha:1];
                contentLB1.backgroundColor = [UIColor colorWithRed:239.0/255 green:243.0/255 blue:255.0/255 alpha:1];
                
                contentLB2.textColor = [UIColor colorWithRed:0.0/255 green:72.0/255 blue:255.0/255 alpha:1];
                contentLB2.backgroundColor = [UIColor colorWithRed:239.0/255 green:243.0/255 blue:255.0/255 alpha:1];
                
                contentLB3.textColor = [UIColor colorWithRed:0.0/255 green:72.0/255 blue:255.0/255 alpha:1];
                contentLB3.backgroundColor = [UIColor colorWithRed:239.0/255 green:243.0/255 blue:255.0/255 alpha:1];
                
                contentLB4.textColor = [UIColor colorWithRed:0.0/255 green:72.0/255 blue:255.0/255 alpha:1];
                contentLB4.backgroundColor = [UIColor colorWithRed:239.0/255 green:243.0/255 blue:255.0/255 alpha:1];
                
                contentLB5.textColor = [UIColor colorWithRed:0.0/255 green:72.0/255 blue:255.0/255 alpha:1];
                contentLB5.backgroundColor = [UIColor colorWithRed:239.0/255 green:243.0/255 blue:255.0/255 alpha:1];
            }
                break;
            case 6:
            {
               titleLB.text = @"电影类型";
                NSMutableArray *array = [NSMutableArray array];
                for (MovieLabelModel *mlm in  _pUser.labels) {
                    if ([mlm.type isEqualToString:@"6"]) {
                        [array addObject:mlm];
                        //                        contentLB.text = [NSString stringWithFormat:@"  %@      ", mlm.name];
                    }
                }
                
                for (int i = 0; i < array.count; i++) {
                    MovieLabelModel *model = [array objectAtIndex:i];
                    if (i == 0) {
                        contentLB.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB setHidden:NO];
                    } else if(i == 1) {
                        contentLB1.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB1 setHidden:NO];
                    } else if(i == 2) {
                        contentLB2.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB2 setHidden:NO];
                    } else if(i == 3) {
                        contentLB3.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB3 setHidden:NO];
                    } else if(i == 4) {
                        contentLB4.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB4 setHidden:NO];
                    } else if(i == 5) {
                        contentLB5.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB5 setHidden:NO];
                    }
                }
                
                
                contentLB.textColor = [UIColor colorWithRed:2.0/255 green:255.0/255 blue:196.0/255 alpha:1];
                contentLB.backgroundColor = [UIColor colorWithRed:239.0/255 green:255.0/255 blue:252.0/255 alpha:1];
                
                contentLB1.textColor = [UIColor colorWithRed:2.0/255 green:255.0/255 blue:196.0/255 alpha:1];
                contentLB1.backgroundColor = [UIColor colorWithRed:239.0/255 green:255.0/255 blue:252.0/255 alpha:1];
                
                contentLB2.textColor = [UIColor colorWithRed:2.0/255 green:255.0/255 blue:196.0/255 alpha:1];
                contentLB2.backgroundColor = [UIColor colorWithRed:239.0/255 green:255.0/255 blue:252.0/255 alpha:1];
                
                contentLB3.textColor = [UIColor colorWithRed:2.0/255 green:255.0/255 blue:196.0/255 alpha:1];
                contentLB3.backgroundColor = [UIColor colorWithRed:239.0/255 green:255.0/255 blue:252.0/255 alpha:1];
                
                contentLB4.textColor = [UIColor colorWithRed:2.0/255 green:255.0/255 blue:196.0/255 alpha:1];
                contentLB4.backgroundColor = [UIColor colorWithRed:239.0/255 green:255.0/255 blue:252.0/255 alpha:1];
                
                contentLB5.textColor = [UIColor colorWithRed:2.0/255 green:255.0/255 blue:196.0/255 alpha:1];
                contentLB5.backgroundColor = [UIColor colorWithRed:239.0/255 green:255.0/255 blue:252.0/255 alpha:1];
            }
                break;
            case 7:
            {
              titleLB.text = @"常去影院";
                NSMutableArray *array = [NSMutableArray array];
                for (MovieLabelModel *mlm in  _pUser.labels) {
                    if ([mlm.type isEqualToString:@"7"]) {
                        [array addObject:mlm];
                    }
                }
                
                for (int i = 0; i < array.count; i++) {
                    MovieLabelModel *model = [array objectAtIndex:i];
                    if (i == 0) {
                        contentLB.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB setHidden:NO];
                    } else if(i == 1) {
                        contentLB1.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB1 setHidden:NO];
                    } else if(i == 2) {
                        contentLB2.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB2 setHidden:NO];
                    } else if(i == 3) {
                        contentLB3.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB3 setHidden:NO];
                    } else if(i == 4) {
                        contentLB4.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB4 setHidden:NO];
                    } else if(i == 5) {
                        contentLB5.text = [NSString stringWithFormat:@"  %@  ", model.name];
                        [contentLB5 setHidden:NO];
                    }
                }
                
                
                contentLB.textColor = [UIColor colorWithRed:.0/255 green:255.0/255 blue:0.0/255 alpha:1];
                contentLB.backgroundColor = [UIColor colorWithRed:240.0/255 green:255.0/255 blue:200.0/255 alpha:1];
                
                contentLB1.textColor = [UIColor colorWithRed:.0/255 green:255.0/255 blue:0.0/255 alpha:1];
                contentLB1.backgroundColor = [UIColor colorWithRed:240.0/255 green:255.0/255 blue:200.0/255 alpha:1];
                
                contentLB2.textColor = [UIColor colorWithRed:.0/255 green:255.0/255 blue:0.0/255 alpha:1];
                contentLB2.backgroundColor = [UIColor colorWithRed:240.0/255 green:255.0/255 blue:200.0/255 alpha:1];
                
                contentLB3.textColor = [UIColor colorWithRed:.0/255 green:255.0/255 blue:0.0/255 alpha:1];
                contentLB3.backgroundColor = [UIColor colorWithRed:240.0/255 green:255.0/255 blue:200.0/255 alpha:1];
                
                contentLB4.textColor = [UIColor colorWithRed:.0/255 green:255.0/255 blue:0.0/255 alpha:1];
                contentLB4.backgroundColor = [UIColor colorWithRed:240.0/255 green:255.0/255 blue:200.0/255 alpha:1];
                
                contentLB5.textColor = [UIColor colorWithRed:.0/255 green:255.0/255 blue:0.0/255 alpha:1];
                contentLB5.backgroundColor = [UIColor colorWithRed:240.0/255 green:255.0/255 blue:200.0/255 alpha:1];
            }
                break;
        }
        return cell;
    }
}

-(UITableViewCell *)cellforRowWithTabelView:(UITableView *)tableView Identifier:(NSString *)identifier{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:identifier];
    }
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row ==0) {
        return 200;
    }else{
        switch (indexPath.row)
        {
            case 1:
                return 50;
                
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            {
                NSMutableArray *array = [NSMutableArray array];
                for (MovieLabelModel *mlm in  _pUser.labels) {
                    if ([mlm.type isEqualToString:@"7"]) {
                        [array addObject:mlm];
                    }
                }

                if (array.count > 3) {
                    return 70;
                } else {
                    return 50;
                }
            }
        }
        return 50;
    
    }

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
